Xbasic

Expression Components

Description

An expression can include any combination of fields, constants, operators, and functions. Refer to the following subsections for more information about how each is used in an expression.

The maximum length of an expression is approximately 950 characters.

Fields

The names of fields can be used directly in an expression. If you are working with more than a single table, you should add the table's name as a prefix. For example if you wanted to multiply the Cost field from the Product table by 1.25, you can use the expression:

PRODUCT->COST * 1.25

Constants

A constant is a fixed value, such as the number 7. When you add constants into an expression, you need to indicate the type of value you are entering, so that Alpha Anywhere processes the value correctly. For example, if you enter 3/12/1997 into an expression, Alpha Anywhere interprets the value as 3 divided by 12 divided by 1997. If you enter {3/12/1997} Alpha Anywhere interprets the value as the date March 12, 1997.

Refer to the following list for instructions on entering each type of constant:

Numeric

Numeric values need no special indicators. Alpha Anywhere assumes any number you type to be a numeric value.

Character

Character values must be enclosed in quotation marks (e.g., "Beth").

Date

Date values must be enclosed in curly braces (e.g., {5/25/68} ).

Logical

To indicate a TRUE value, type .T. To indicate a FALSE value, type .F.

Operators

Operators are used to connect multiple expression components together so that they evaluate to a single value. For example, you can use the plus operator (+) to connect the numeric constants 3 and 4, creating the expression 3+4. For a complete discussion of operators, refer to the Using Operators section later in this chapter.

Functions

A function is a pre-defined keyword that performs some operation and returns a value. For example, the function DATE()returns today's date. While the UPPER() function takes a character string and converts it to upperitem: UPPER("beth") evaluates to "BETH".

See Also